package com.entity;

import com.selfException.MyException;

public class User {

    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws MyException {
        if (age < 0 || age > 120) {
            throw new MyException("年龄必须在0-120之间");
        }
        this.age = age;
    }
}
